package common.service.impl.jedis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import common.service.JedisClient;

import java.util.Map;


public class JedisTemplate implements JedisClient {

	@Autowired
	private RedisTemplate redisTemplate;

	
	public String set(String key, String value) {
		//Jedis jedis = (Jedis) jedisConnectionFactory.getConnection().getNativeConnection();
		//String result = jedis.set(key, value);
		//jedis.close();
		return null;
	}

	
	public String get(String key) {
		//Jedis jedis = (Jedis) jedisConnectionFactory.getConnection().getNativeConnection();
		//String result = jedis.get(key);
		//jedis.close();
		return null;
	}

	
	public Boolean exists(String key) {
		//Jedis jedis = (Jedis) jedisConnectionFactory.getConnection().getNativeConnection();
		//Boolean result = jedis.exists(key);
		//jedis.close();
		return null;
	}

	
	public Long expire(String key, int seconds) {
		//Jedis jedis = (Jedis) jedisConnectionFactory.getConnection().getNativeConnection();
		//Long result = jedis.expire(key, seconds);
		//jedis.close();
		return null;
	}

	
	public Long ttl(String key) {
		//Jedis jedis = (Jedis) jedisConnectionFactory.getConnection().getNativeConnection();
		//Long result = jedis.ttl(key);
		//jedis.close();
		return null;
	}

	
	public Long incr(String key) {
		//Jedis jedis = (Jedis) jedisConnectionFactory.getConnection().getNativeConnection();
		//Long result = jedis.incr(key);
		//jedis.close();
		return null;
	}

	
	public Long hset(String key, String field, String value) {
		return null;
	}

	
	public String hget(String key, String field) {
		return  (String) redisTemplate.opsForHash().get(key, field);
	}


	
	public Long hdel(String key, String... field) {

		return (Long) redisTemplate.opsForHash().get(key, field);
	}

	@Override
	public int init(Map<String,Object> params) {
		return 0;
	}


}
